package com.net.shop.car.manager.api.volley.request;

import org.json.JSONException;
import org.json.JSONObject;

import com.net.shop.car.manager.api.volley.Request;
import com.net.shop.car.manager.utils.Constants;
import com.net.shop.car.manager.utils.LogUtils;

/**
 * 请使用LoginResponse作响应
 * @author 登录
 *
 */
public class Login extends Request {
	
	/**
	 * 
	 */
	private final String loginName;
	/**
	 * 
	 */
	private final String pwd;
	/**
	 * 
	 */
	private final String androidUserId;
	
	/**
	 * 
	 */
	private final String androidChannelId;

	/**
	 * @param loginName
	 * @param pwd
	 * @param androidUserId
	 * @param androidChannelId
	 */
	public Login(String loginName, String pwd,
			String androidUserId, String androidChannelId) {
		super(Constants.LOGIN);
		this.loginName = loginName;
		this.pwd = pwd;
		this.androidUserId = androidUserId;
		this.androidChannelId = androidChannelId;
	}

	@Override
	public void extensionJSON(JSONObject jsonObject) {
		try {
			jsonObject.put("loginname", loginName);
			jsonObject.put("pwd", pwd);
			jsonObject.put("apptype", Constants.ANDROID_TAG);
			jsonObject.put("android_user_id", androidUserId);
			jsonObject.put("android_channel_id", androidChannelId);
		} catch (JSONException e) {
			LogUtils.e(e.getMessage());
		}
	}

	public String getLoginName() {
		return loginName;
	}

	public String getPwd() {
		return pwd;
	}

	public String getAndroidUserId() {
		return androidUserId;
	}

	public String getAndroidChannelId() {
		return androidChannelId;
	}

	@Override
	public String toString() {
		return "Login [loginName=" + loginName + ", pwd=" + pwd + ", androidUserId=" + androidUserId + ", androidChannelId=" + androidChannelId + "]";
	}
}
